<%@ page contentType="text/html; charset=utf-8" language="java"
	errorPage=""%>
<%@ page isELIgnored="false"%>
<%@ include file="/web/common/taglibs.jsp"%>
<base target="_self">
<sx:head />
<s:head />
<link href="web/css/global.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="web/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="web/js/common.js"></script>
<script>
var noPermit = "<s:property value='#request.nopermit' />";
if("true" == noPermit){
	alert('请重新登录！');
	closeWindow();
}
var noUser = "<s:property value='#request.nouser' />";
if("true" == noUser){
	alert('此用户不存在！');
	closeWindow();
}
var error = "<s:property value='#request.error' />";
if("true" == error) {
	alert('操作失败，请重试！');
	closeWindow();
}
var createId = "<s:property value='#request.createid' />";
if(createId != 'null' && createId != ''){
	alert('用户创建成功！');
	closeWindow();
} else {
	
}
function closeWindow() {
    window.close();
}
function getRoleLabelListById(data){
	$("#roleIdList").append($("<OPTION>"));
	for(var i = 0; i < data.roleList.length; i++){
		var op = $("<OPTION>");
		op.attr('label',data.roleList[i].label);
		op.val(data.roleList[i].value);
		$("#roleIdList").append(op);
	}
}
function getDisabledList(data){
	for(var i = 0; i < data.disabledList.length; i++){
		var op = $("<OPTION>");
		op.attr('label',data.disabledList[i].label);
		op.val(data.disabledList[i].value);
		$("#disabledList").append(op);
	}
}
$(document).ready(function(){
	var url = 'adminAjaxGetRoleList';
    //jQuery.post(url, null, getRoleLabelListById, 'json');
    url = 'adminAjaxGetDisabeldList';
    //jQuery.post(url, null, getDisabledList, 'json');
});
function checkUserExist(){
	var url = 'adminAjaxCheckUserExist';
	var params = {userId:$('#newUserId').attr('value')};
	jQuery.post(url, params, showUserExistError, 'json');
}
function showUserExistError(data){
	$('#error').html(data.result);
}

</script>
<s:form action="jfAdminMemberEdit" method="post" theme="css_xhtml">
	<s:hidden name="target" value="popAdminMemberCreate"></s:hidden>

	<div class="div-title" style="width: 100%">&nbsp; <s:property
		value='%{getText("msg_admin_member_create_title")}' /></div>
	<div class="div-group" style="margin-top: 10px;">
	<table class="tb-common" width="94%" border="0">
		<tr>
			<td class="tb-label2" width="80px">
			<p class="p-label"><s:property
				value='%{getText("msg_admin_member_user_id")}' /></p>
			</td>
			<td width="20%"><s:textfield id="newUserId" name="newUserId"
				cssClass="txt-common" onchange="checkUserExist()"></s:textfield></td>
			<td><label class="errorText" id="error" ></label></td>
		</tr>
		<tr>
			<td class="tb-label2" width="80px">
			<p class="p-label"><s:property
				value='%{getText("msg_admin_member_nickname")}' /></p>
			</td>
			<td width="20%"><s:textfield name="newNickname"
				cssClass="txt-common"></s:textfield></td>
			<td></td>
		</tr>
		<tr>
			<td class="tb-label2" width="80px">
			<p class="p-label"><s:property
				value='%{getText("msg_admin_member_email")}' /></p>
			</td>
			<td width="20%"><s:textfield name="newEmailAddress"
				cssClass="txt-common"></s:textfield></td>
		</tr>
		<tr>
			<td class="tb-label2" width="80px">
			<p class="p-label"><s:property
				value='%{getText("msg_admin_member_role")}' /></p>
			</td>
			<td width="20%"><s:select name="newRoleId"
				cssClass="select-common" cssStyle="width:100px"
				list="roleList" headerKey="" headerValue=""
				listKey="value" listValue="label">
			</s:select></td>
		</tr>
		<tr>
			<td class="tb-label2" width="80px">
			<p class="p-label"><s:property
				value='%{getText("msg_admin_member_disabled")}' /></p>
			</td>
			<td width="20%"><s:select name="newDisabled"
				cssClass="select-common" cssStyle="width:100px"
				list="disabledList" 
				listKey="value" listValue="label">
			</s:select></td>
			<td></td>
		</tr>
		<tr>
			<td colspan="3"><br>
			<s:submit method="doMemberCreate" cssClass="btn-90"
				value='%{getText("btn_new")}' /> &nbsp; <input type="button"
				class="btn-90" onclick="closeWindow()"
				value='<s:property value="%{getText('btn_close')}" />' /></td>
		</tr>
	</table>
	</div>
</s:form>
